import baseUrl from '@/request/baseUrl.js'

function request(url, method = `GET`, data = {}) {
	return new Promise((resolve, reject) => {
		wx.request({
			url: baseUrl + url,
			method,
			data,
			success: res => {
				if (res.statusCode === 200) {
					resolve(res)
				}
			},
			fail: err => {
				reject(err)
			}
		})
	})
}

export function index() {
	return request(`/api/hospital/index`)
}
export function section() {
	return request('/api/doctor/section')
}
export function information() {
	return request('/api/hospital/information')
}
export function doctorIndex(data) {
	return request('/api/doctor/index', 'GET', data)
}
export function doctorSeay() {
	return request('/api/doctor/seay')
}
export function userExitInfo(data) {
	return request('/api/user/exit_info', 'GET', data)
}
export function getSessionKey(data) {
	return request('/api/user/getsessionkey', 'GET', data)
}
export function autoLogin(data) {
	return request('/api/user/authlogin', 'GET', data)
}
export function records(data) {
	return request('/api/user/records', 'GET', data)
}
export function getUserInfo(data) {
	return request('/api/user/info', 'GET', data)
}
export function doctorDetail(data) {
	return request('/api/doctor/detail', 'GET', data)
}
export function doctorNum(data) {
	return request('/api/doctor/num', 'GET', data)
}
export function reservatio(data) {
	return request('/api/doctor/reservatio', 'GET', data)
}
export function record(data) {
	return request('/api/doctor/record', 'GET', data)
}
export function recordDetail(data) {
	return request('/api/doctor/record_detail', 'GET', data)
}
export function give(data) {
	return request('/api/doctor/give', 'GET', data)
}
export function cancelReservatio(data) {
	return request('/api/doctor/cancel_reservatio', 'GET', data)
}
export function editReservatio(data) {
	return request('/api/doctor/edit_reservatio', 'GET', data)
}
export function hierarchyFees(data) {
	return request('/api/hierarchy/fees', 'GET', data)
}